<!--<?php
print <<<EOT
-->

<script src="css/edit.js"></script>
<script>
<!--

function validate(form) {
    var id_ary = $js_id_ary_str;
    for (var i=0; i<id_ary.length; i++) {
        if (document.all('cart_qty['+id_ary[i]+']').value>document.all('inventory_qty['+id_ary[i]+']').value) {
            //alert('Your input number \''+document.all('cart_qty['+id_ary[i]+']').value+'\' ');
            alert('The number you enter \''+document.all('cart_qty['+id_ary[i]+']').value+'\' is more than the available quantity.');
            return false;
        }
    }

    return ture;
}
//CartItem ID Array
var cartItemIDAry = null;
function cart_item_change(k)
{
	var curprice = $('#h_price_'+k).val();
	$.ajax({
		url:'do.php?t=2&k='+$('#new_key_'+k).val()+'&choice='+$('#selfab_'+k).val()+"&fitemid="+$('#sel_finish_'+k).val(),
		type:'GET',
		beforeSend:function(){
			$('#td_price_'+k).html('<img src="./images/loading.gif"/>');
		},
		success:function(d){
			if(d=='null' || d=='')
			{
				$('#td_price_'+k).html(0);
				return;
			}
			d= eval('('+d+')');
			if(d.id != '' && d.id != null)
			{
				$('#td_name_'+k).html(d.name);
				$('#td_code_'+k).html(d.code);
				$('#td_price_'+k).html(d.price);
				$('#new_key_'+k).val(d.new_key);
			}
			else
			{
				$('#td_price_'+k).html(0);
			}
			var cost = parseInt($('#qty_'+k).val())*parseFloat($('#td_price_'+k).html().replace(',',''));
			$("#cost_"+k).html(milliFormat(cost));
			fresh_price();
		},
		error:function(){
			$('#td_price_'+k).html(curprice);
		},
		timeout:function(){
			$('#td_price_'+k).html(curprice);
		}
	});
}
function fresh_price()
{
	var total = 0;
	$(".td_cost").each(function(){
		total += parseFloat($(this).html().replace(',',''));
	});
	$("#total_cost").html(milliFormat(total));
}
function milliFormat(s)
{
		s = s.toString();
        if(/[^0-9\.]/.test(s))
		{
		 return "invalid value";  
		 }
        s=s.replace(/^(\d*)$/,"$1.");  
        s=(s+"00").replace(/(\d*\.\d\d)\d*/,"$1");  
        s=s.replace(".",",");  
        var re=/(\d)(\d{3},)/;  
        while(re.test(s)){  
            s=s.replace(re,"$1,$2");  
        }  
        s=s.replace(/,(\d\d)$/,".$1");  
        return s.replace(/^\./,"0.")  
    }  
//-->
</script>

 <div class="main_R" style="overflow:hidden; vertical-align:top; width:745px;"> 
 
  <div class="tb-top-logo">
    <img src="css/images/about_jansen_furniture.jpg" alt="" />
       </div>
              <div class="right-pad">
 
 
                  <table width="745" border="0" cellspacing="0" cellpadding="0" >                   
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                                       
                      <td bgcolor="FFFFFF" class="text" align="left" valign="top">
                       
               

<!--
EOT;
if (count($info_ary) == 0) {
print <<<EOT
--> 			        	
					   <div class="titles">Sorry Your Container is Empty!</div>
					   Please browse through the various product sections and add the desired items to your cart with the 'Add to container' button on the product detail page.


<!--
EOT;
} else {
print <<<EOT
--> 

			        	<form action="cart_view.php" method="post" name="form1"  onSubmit="return validate(this)">
			        	<input type="hidden" name="act" value="change">
			    		<table width="740" border="0" cellspacing="0" cellpadding="0" align="center">			    		
			    		<tr>
			    		<td colspan=11>
        			      <table width="100%" border="0" cellspacing="0" cellpadding="0">        			    	
        			        <tr><td align="right" width="64"><strong>Customer</strong> :</td><td align="left" >&nbsp;{$user_info_ary['firstname']} {$user_info_ary['lastname']}</td></tr>
			    		    <tr><td align="right" width="64"><strong>City</strong> :</td><td align="left" >&nbsp;{$user_info_ary['city']}</td></tr>
			    		    <tr><td align="right" width="64"><strong>Country</strong> :</td><td align="left" >&nbsp;{$COUNTRY_ARY[$user_info_ary['countryid']]}</td></tr>
			    		  </table>
			    		</td>
			    		</tr>  
			    		<tr><td colspan=14 height=5></td></tr>	
			    		<tr><td colspan=14 bgcolor="#000000" height=1></td></tr>															
						<tr class="cartAlternatingRowB">
			    			<td align="center" valign="middle" class="cartHeading" width="45"></td>
			    			<td align="left" ></td>
			    			<td align="left" valign="middle" class="cartHeading" width="55">Item No.</td>
								<td align="right" valign="middle" class="cartHeading" width="10"></td>
			    			<td align="left" valign="middle" class="cartHeading" width="145">Description</td>
			    			<td align="left" valign="middle" class="cartHeading" width="70">Finish</td>
			    			<td align="right" valign="middle" class="cartHeading" width="10"></td>
							<td align="left" valign="middle" class="cartHeading" width="80">Fabric / Leather</td>
			    			<td align="right" valign="middle" class="cartHeading" width="40">CBM</td>
			    			<td align="right" valign="middle" class="cartHeading" width="42">CUFT</td>
			    			<td align="right" valign="middle" class="cartHeading" width="55">Price<br>{$money_type}</td>
			    			<td align="right" valign="middle" class="cartHeading" width="40">Qty</td>
			    			<td align="right" valign="middle" class="cartHeading" width="60">Total<br>{$money_type}</td>
			    			<td align="center" valign="middle" class="cartHeading" width="60" height="30">Remove</td>
						</tr>
						<tr><td colspan=14 bgcolor="#A5AAB0" height=1></td></tr>
						
						<tr><td colspan=14bgcolor="#FFFFFF" height=4></td></tr>
			
<!--
EOT;

foreach ($index_ary as $v) {    
	$v['price']  = number_format($v['price'], 2, '.', ',');
	$v['cost']   = number_format($v['cost'], 2, '.', ',');
	$v['cbm']    = number_format($v['cbm'], 2, '.', ',');
	$v['cuft']   = number_format($v['cuft'], 2, '.', ',');	
	$v['name'] = ucwords(strtolower($v['name']));
print <<<EOT
-->
			            <tr class="cartAlternatingRowB1" height=45>
			    			<td align="center" valign="top" width="45"><a href="product_details.php?pid={$v['id']}#atpic"><img src="./zh/attachments/{$v['small_pic']}" border="0" class="picture" width="40" height="40"></a></td>
			    			<td align="left" width="8"></td>
			    			<td align="left" valign="middle" width="50" id="td_code_{$v['key']}">{$v['code']}</td>
							<td align="left" width="8"></td>
			    			<td align="left" valign="top" width="140" class="cartmiddle"><span class="cartmiddle2" id ="td_name_{$v['key']}">{$v['name']}</span></td>
                            <td align="left" valign="middle" width="70">
							<input type="hidden" id="new_key_{$v['key']}" name="new_key[{$v['key']}]" value="{$v['key']}"/><select style="width: 70px; height:17px; padding:0; margin:0;" id="sel_finish_{$v['key']}" name="selFinish[{$v['key']}]" onchange="cart_item_change('{$v['key']}')">
<option value='0'>-Select-</option>							
 <!--
EOT;
$finish_items = isset($finish_item_ary[$v["finish_id"]])?$finish_item_ary[$v["finish_id"]]:array();
foreach ($finish_items as $finish_item) {    		
		if($finish_item['id'] == $v["fitemid"])
		    $selected = " selected";
		else 
		    $selected = "";		   
print <<<EOT
-->
    <option value='{$finish_item['id']}' {$selected}>{$finish_item['name']}</option>
 <!--
EOT;
} 
print <<<EOT
--> 			    			
			    			</select><input type="hidden" name="fitemid[{$v['key']}]" value="{$v['fitemid']}" size="3"></td>
                            <td align="right" valign="middle"></td>
							<td align="left" valign="middle">			
<select style="width: 70px; height:17px; padding:0; margin:0;" id="selfab_{$v['key']}" name="selfab[{$v['key']}]" onchange="cart_item_change('{$v['key']}')">
<option value='0'>-Select-</option>						
 <!--
EOT;
$strs="";

	foreach($fabrics_item_ary as $fab) 	
	{    		
			if($fab['id']==$v["fabid"] && $v["fabid"] > 0)
			{
				$selected = "selected";
			}
			else 
				$selected = "";		   
$strs.='<option value="f_'.$fab['id'].'" '.$selected.'>'.$fab['name'].'</option>';	
	}

	foreach($leathers_item_ary as $lea) 	
	{    		
			if($lea['id']==$v["leaid"] && $v["leaid"] > 0)
			{
				$selected = "selected";
				}
			else 
				$selected = "";		   
$strs.='<option value="l_'.$lea['id'].'" '.$selected.'>'.$lea['name'].'</option>';	
	}
print <<<EOT
	--> 	
			{$strs}					
						</select></td>
			    			<td align="right" valign="middle">{$v['cbm']}</td>
			    			<td align="right" valign="middle">{$v['cuft']} 
							<input type="hidden" id="h_price_{$v['key']}" value="{$v['price']}"/></td>
			    			<td align="right" valign="middle" id="td_price_{$v['key']}">{$v['price']}</td>
			    			<td align="right" valign="middle"><input type="text" id="qty_{$v['key']}" name="cart_qty[{$v['key']}]" value="{$v['count']}" size="3" style="text-align:right">
							</td>
			    			{$v['js_str']}
			    			<td align="right" valign="middle" width="60" class="td_cost" id="cost_{$v['key']}">{$v['cost']}</td>
			    			<td align="center" valign="middle" width="60" height="30">
			    			<a onclick="return confirm('Do you really want to remove {$v['name']} from your cart?')" href="cart_view.php?act=delone&pid={$v['key']}"  onmouseover="jf_button_remove_{$v['id']}.src='./images/button/bt_delete.gif'" onmouseout="jf_button_remove_{$v['id']}.src='./images/button/bt_delete.gif'" ><img src="./images/button/bt_delete.gif" alt="Remove This Item From Your Container" name="jf_button_remove_01" width="26" height="14" border="0" id="jf_button_remove_{$v['id']}"></a>
			    			</td>
						</tr>

<!--
EOT;
} 

print <<<EOT
--> 
						<tr><td colspan=14 bgcolor="#A5AAB0" height=1></td></tr>
						
						
						<tr>
						    <td colspan=8 height=25 align="right"><strong>Total&nbsp;</strong> :</td>
			    			
			    			<td align="right" valign="middle"><div class="kk">{$total_cbm} </div></td>
			    			<td align="right" valign="middle"><div class="kk">&nbsp;{$total_cuft} </div></td>
			    			<td align="right" valign="middle"></td>
			    			<td align="right" valign="middle"><div class="kk">{$total_qty2} </div></td>
			    			
			    			
			    			
			    			<td align="right"><div class="kk" id="total_cost">$total_cost </div></td>	
			    			<td></td>	  	    			
						
						
						 
						</tr>
						
						
						<tr><td colspan=14 bgcolor="#000000" height=1></td></tr>
						<tr><td colspan=14 height=28 align="right" valign="middle">
						
                              
						
						<a href="javascript:;" onClick="MM_openBrWindow('printer.php?page=cart_view','printerfriendly','scrollbars=yes,width=600,height=500')" onMouseOver="MM_swapImage('jf_button_printer_friendly','','./images/button/jf_button_print-over.gif',1)" onMouseOut="MM_swapImgRestore()">
                        <img src="./images/button/jf_button_print.gif" alt="Printer Friendly" name="jf_button_printer_friendly" width="90" height="20" border="0"  align="absmiddle" id="jf_button_printer_friendly">
                        </a>
						
                        <input type="image" onMouseOver="MM_swapImage('cart_update','','./images/button/jf_button_update_quantities-over.gif',1)" onMouseOut="MM_swapImgRestore()" src="./images/button/jf_button_update_quantities.gif" alt="Update" name="cart_update" width="90" height="20" border="0" id="cart_update" align="absmiddle">
						
                        
						<A onmouseover="cart_checkout.src='./images/button/jf_button_submit_order-over.gif'" onmouseout="cart_checkout.src='./images/button/jf_button_submit_order.gif'" onclick="{$v['cuft']}" href="cart_submit.php">
						<IMG id="cart_checkout" alt="Checkout" src="./images/button/jf_button_submit_order.gif" width=90 border=0 align="absmiddle">
						</A>
						
						</td></tr>
						</table></form>
						
<!--
EOT;
}
print <<<EOT
--> 


                      
                      </td>
                      
                     
                    
                    </tr>

<!--
EOT;
if (count($info_ary) > 0) {
print <<<EOT
-->                    
                    
                    <tr>
                    <td colspan="2" height="30"></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                 
                      <td bgcolor="FFFFFF" colspan=1><strong>Attention:</strong> Submit Order will empty the container. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you are not yet finished with your order, please just <a href="javascript:;" onClick="MM_openBrWindow('printer.php?page=cart_view','printerfriendly','scrollbars=yes,width=600,height=500')" onMouseOver="MM_swapImage('jf_button_printer_friendly','','./images/button/jf_button_print-over.gif',1)" onMouseOut="MM_swapImgRestore()">Print</a> the list.</td>
                     
                      
                    </tr>
                    
<!--
EOT;
}
print <<<EOT
--> 
                   
                   
                    
                   </table>   
                  
                </div>
           
       </div>              
   	</div>
<!--
EOT;
?>-->